package com.situ.swing111;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class ShouYeFrame extends JFrame {
	public static void main(String[] args) {
		JFrame jf = new JFrame();
		jf.setSize(600, 400);    //窗口大小
		jf.setLocation(400,100);  //距离左上坐标位置
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //设置默认退出
		jf.setVisible(true);   //显示在界面上
//		jf.setResizable(false);//固定窗口
		
		JPanel panel = new JPanel();//设置容器
		jf.add(panel);
		
		panel.setLayout(new FlowLayout());//容器布局
		
		JPanel anniuPanel = new JPanel(); 
		anniuPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 100, 110));
		JButton xueShengpanel = new JButton("学生管理");
		JButton jiaoShipanel = new JButton("教师管理");
		anniuPanel.add(xueShengpanel);
		anniuPanel.add(jiaoShipanel);
		panel.add(anniuPanel);
		xueShengpanel.setPreferredSize(new Dimension(160, 90));
		jiaoShipanel.setPreferredSize(new Dimension(160, 90));
		xueShengpanel.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				MainFrame mainFrame = new MainFrame();
				mainFrame.init();
			}
		});
		jiaoShipanel.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				MainFrameTeatch mainFrameTeatch = new MainFrameTeatch();
				mainFrameTeatch.init();
			}
		});
	}
}
